<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>入职申请</title>
    <script src="../../../../res/js/jquery-3.4.1.min.js" charset="utf-8"></script>
    <script src="../../../../res/js/login_common.js" charset="utf-8"></script>
    <script src="../../../../res/layui/layui.js" charset="utf-8"></script>
    <script src="../../../../res/js/Tools.js" charset="utf-8"></script>
    <link rel="shortcut icon" type="image/x-icon" href="../../../../res/images/favicon.ico">
    <link rel="stylesheet" href="../../../../res/layui/css/layui.css" media="all">
    <style>
        #isHealthMaimLevel {
            display: none;
        }
    </style>
</head>
<body style="padding: 10px">
<div style="display: none" id="bodys">


    <form action="" class="layui-form layui-form-pane">
        <h1 align="center" style="margin-bottom: 20px">员工入职登记表</h1>
        <input name="pkEntryId" id="pkEntryId" type="hidden"/>
        <input name="isRevision" id="isRevision" type="hidden"/>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" lay-verify="required" name="entryArea"
                           id="entryArea" placeholder="请输入名字（必填）"
                           type="text"/>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">出生日期</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="entryBirthday" lay-verify="date"
                           name="entryBirthday"
                           placeholder="yyyy-MM-dd"
                           type="text">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">身份证号</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" lay-verify="required" id="entryIdentity"
                           name="entryIdentity" placeholder="请输入身份证号"
                           type="text"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">民族</label>
                <div class="layui-input-inline">
                    <select lay-verify="required" name="entryNation" id="entryNation">
                        <option value="">请选择民族（必填）</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">籍贯</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" lay-verify="required" name="entryNativeProvince"
                           id="entryNativeProvince" placeholder="请输入籍贯（必填）"
                           type="text"/>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">电话</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="entryPhone" lay-verify="required|phone"
                           name="entryPhone"
                           placeholder="电话"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">最高学历</label>
                <div class="layui-input-inline">
                    <select lay-verify="required" id="entryEducation" name="entryEducation">
                        <option value="">请选择学历（必填）</option>
                        <option value="1">研发</option>
                        <option value="2">打酱油</option>
                        <option value="3">测试</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">专业</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="entryMajor" lay-verify="required"
                           name="entryMajor"
                           placeholder="专业（必填）"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">外语及等级</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="entryForeignLevel" lay-verify="required"
                           name="entryForeignLevel"
                           placeholder="外语及等级（必填）"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">职业资格</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="entryProfessionalQualification"
                           lay-verify="required"
                           name="entryProfessionalQualification"
                           placeholder="职业资格（必填）"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">专业职称</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="entryMajorQualification" lay-verify="required"
                           name="entryMajorQualification"
                           placeholder="专业职称（必填）"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">银行账户</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="entryBankAccount" lay-verify="required"
                           name="entryBankAccount"
                           placeholder="银行账户（必填）"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">开户行</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="entryBankName" lay-verify="required"
                           name="entryBankName"
                           placeholder="开户行（必填）"
                           type="text">
                </div>
            </div>

            <div class="layui-form-item" style="width: 296px;display: inline-block;" pane="">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <input type="radio" id="entrySexMan" name="entrySex" value="1" title="男" checked="">
                    <input type="radio" id="entrySexGirl" name="entrySex" value="0" title="女">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">户口所在地</label>
            <div class="layui-input-block">
                <input type="text" name="entryNativeCity" id="entryNativeCity" lay-verify="required" autocomplete="off"
                       placeholder="户口所在地（必填）"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" pane="">
            <label class="layui-form-label">婚姻状况</label>
            <div class="layui-input-block">
                <input type="radio" id="isMarriage0" name="isMarriage" value="0" title="已婚">
                <input type="radio" id="isMarriage1" name="isMarriage" value="1" title="未婚" checked="">
                <input type="radio" id="isMarriage3" name="isMarriage" value="3" title="再婚">
                <input type="radio" id="isMarriage2" name="isMarriage" value="2" title="离异">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">现住邮编</label>
            <div class="layui-input-inline">
                <input autocomplete="off" class="layui-input" lay-verify="required" name="entryPostcode"
                       id="entryPostcode" placeholder="请输入邮编（必填）"
                       type="text"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">现住地址</label>
            <div class="layui-input-block">
                <input type="text" name="entryCurrentResidence" id="entryCurrentResidence" lay-verify="required"
                       autocomplete="off" placeholder="现住地址（必填）"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">通信邮编</label>
            <div class="layui-input-inline">
                <input autocomplete="off" class="layui-input" lay-verify="required" name="entryPostcodeResidence"
                       id="entryPostcodeResidence" placeholder="请输入邮编（必填）"
                       type="text"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">通信地址</label>
            <div class="layui-input-block">
                <input type="text" name="entryCommunicationResidence" id="entryCommunicationResidence"
                       lay-verify="required"
                       autocomplete="off" placeholder="通信地址（必填）"
                       class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 116px">身高</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="healthHeight"
                           name="healthHeight"
                           placeholder="身高"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 116px">体重</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="healthWeight"
                           name="healthWeight"
                           placeholder="体重"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 116px">参加工作时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="dimissionTime" id="dimissionTime" lay-verify="date"
                           placeholder="yyyy-MM-dd（必填）"
                           autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 116px">累计工作时间</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" lay-verify="required" id="accumulativeDate"
                           name="accumulativeDate" placeholder="累计工作时间（必填）"
                           type="text"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 116px">应聘信息来源</label>
                <div class="layui-input-inline">
                    <select lay-verify="required" name="recruitmentInformation" id="recruitmentInformation">
                        <option value="">请选择等级（必填）</option>
                        <option value="1">研发</option>
                        <option value="2">打酱油</option>
                        <option value="3">测试</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 116px">入职部门</label>
                <div class="layui-input-inline">
                    <select lay-verify="required" lay-filter="departmentId" name="departmentId" id="departmentId">
                        <option value="">请选择等级（必填）</option>
                        <option value="1">研发</option>
                        <option value="2">打酱油</option>
                        <option value="3">测试</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 116px">入职岗位</label>
                <div class="layui-input-inline">
                    <select lay-verify="required" name="postId" id="postId">
                        <option value="">请选择岗位（必填）</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 116px">入职时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="affirmTime" id="affirmTime" lay-verify="date" placeholder="yyyy-MM-dd（必填）"
                           autocomplete="off"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item" style="width: 303px;display: inline-block;margin-right:20px;" pane="">
                <label class="layui-form-label" style="width: 116px">视力</label>
                <div class="layui-input-block">
                    <input type="radio" id="isHealthEyesight1" name="isHealthEyesight" value="1" title="良好" checked="">
                    <input type="radio" id="isHealthEyesight0" name="isHealthEyesight" value="0" title="辅助">
                </div>
            </div>
            <div class="layui-form-item" style="width: 303px;display: inline-block;margin-right:20px;" pane="">
                <label class="layui-form-label" style="width: 116px">听力</label>
                <div class="layui-input-block">
                    <input type="radio" id="isHealthEar1" name="isHealthEar" value="1" title="良好" checked="">
                    <input type="radio" id="isHealthEar0" name="isHealthEar" value="0" title="辅助">
                </div>
            </div>
        </div>


        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">录用条件</label>
            <div class="layui-input-block">
            <textarea type="textarea" id="employCondition" name="employCondition" class="layui-textarea">
            </textarea>
            </div>
        </div>
        <div>
            <div class="layui-form-item layui-form-text">
                <div class="layui-input-block" id="oaEntryEducations">
                    <fieldset class="layui-elem-field">
                        <legend>教育经历</legend>
                        <div class="layui-field-box">
                            <table class="layui-table" id="oaEntryEducation"
                                   lay-filter="oaEntryEducation">
                            </table>
                        </div>
                    </fieldset>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <div class="layui-input-block" id="oaEntryWorks">
                    <fieldset class="layui-elem-field">
                        <legend>工作经历</legend>
                        <div class="layui-field-box">
                            <table class="layui-table" id="oaEntryWork"
                                   lay-filter="oaEntryWork">

                            </table>
                        </div>
                    </fieldset>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <div class="layui-input-block" id="oaEntryTrains">
                    <fieldset class="layui-elem-field">
                        <legend>培训经历</legend>
                        <div class="layui-field-box">
                            <table class="layui-table" id="oaEntryTrain"
                                   lay-filter="oaEntryTrain">
                            </table>
                        </div>
                    </fieldset>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <div class="layui-input-block" id="oaEntryFamilys">
                    <fieldset class="layui-elem-field">
                        <legend>家庭成员</legend>
                        <div class="layui-field-box">
                            <table class="layui-table" id="oaEntryFamily"
                                   lay-filter="oaEntryFamily">
                            </table>
                        </div>
                    </fieldset>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <div class="layui-input-block" id="oaEmergencyContacts">
                    <fieldset class="layui-elem-field">
                        <legend>紧急联络人</legend>
                        <div class="layui-field-box">
                            <table class="layui-table" id="oaEmergencyContact"
                                   lay-filter="oaEmergencyContact">

                            </table>
                        </div>
                    </fieldset>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-form-item" pane="" style="width: 525px;float: left">
                <label class="layui-form-label" style="width: 455px">是否曾被认定为工伤或职业病或持有残疾人证明</label>
                <div class="layui-input-block" style="margin-left: 455px;">
                    <input type="checkbox" name="isHealthInjury" id="isHealthInjury" lay-skin="switch" lay-text="是|否">
                </div>
            </div>


            <div class="layui-form-item" pane="" style="width: 525px;float: left">
                <label class="layui-form-label" style="width: 455px">是否从事过井下、高空、高温、特别繁重体力劳动已经有毒有害工种</label>
                <div class="layui-input-block" style="margin-left: 455px;">
                    <input type="checkbox" name="isHealthHeavyManual" id="isHealthHeavyManual" lay-skin="switch"
                           lay-text="是|否">
                </div>
            </div>
            <div class="layui-form-item" pane="" style="width: 525px;float: left">
                <label class="layui-form-label" style="width: 455px">是否有传染性疾病以及何疾病</label>
                <div class="layui-input-block" style="margin-left: 455px;">
                    <input type="checkbox" name="isHealthContagion" id="isHealthContagion" lay-skin="switch"
                           lay-text="是|否">
                </div>
            </div>
            <div class="layui-form-item" pane="" style="width: 525px;float: left">
                <label class="layui-form-label" style="width: 455px">是否已经休了本年度年休假</label>
                <div class="layui-input-block" style="margin-left: 455px;">
                    <input type="checkbox" name="isAnnualVacation" id="isAnnualVacation" lay-skin="switch"
                           lay-text="是|否">
                </div>
            </div>

            <div class="layui-form-item" pane="" style="width: 525px;float: left">
                <label class="layui-form-label" style="width: 455px">是否曾经或正在追究与承担过刑事责任</label>
                <div class="layui-input-block" style="margin-left: 455px;">
                    <input type="checkbox" name="isPenal" id="isPenal" lay-skin="switch" lay-text="是|否">
                </div>
            </div>

            <div class="layui-form-item" pane="" style="width: 525px;float: left">
                <label class="layui-form-label" style="width: 455px">是否在本公司工作过</label>
                <div class="layui-input-block" style="margin-left: 455px;">
                    <input type="checkbox" name="formeWork" id="formeWork" lay-skin="switch" lay-text="是|否">
                </div>
            </div>
            <div class="layui-form-item" pane="" style="width: 525px;float: left" id="isHealthMaims">
                <label class="layui-form-label" style="width: 455px">是否被劳动能力鉴定委员会鉴定为具有伤残等级以及几何级伤残</label>
                <div class="layui-input-block" style="margin-left: 455px;">
                    <input type="checkbox" name="isHealthMaim" id="isHealthMaim" lay-filter="switchTest"
                           lay-skin="switch" lay-text="是|否">
                    <div id="isHealthMaimLevel">
                        <select name="healthMaimGrade" id="healthMaimGrade">
                            <option value="">请选择等级</option>
                            <option value="1">研发</option>
                            <option value="2">打酱油</option>
                            <option value="3">测试</option>
                        </select>
                    </div>

                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 455px">最近六个月内所接收的医学治疗于医学检查</label>
            <div class="layui-input-block" style="margin-left:455px">
                <input type="text" name="healthTreat" id="healthTreat" placeholder="请输入"
                       class="layui-input">
            </div>
        </div>
        <div id="entryCheck">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">试用期限</label>
                    <div class="layui-input-inline">
                        <input autocomplete="off" class="layui-input" id="trialDate" lay-verify="required"
                               name="trialDate"
                               placeholder="试用期限(月)（必填）"
                               type="text">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">试用期工资</label>
                    <div class="layui-input-inline">
                        <input autocomplete="off" class="layui-input" id="trialMoney" lay-verify="required"
                               name="trialMoney"
                               placeholder="试用期工资（必填）"
                               type="text">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 116px">正式期工资</label>
                    <div class="layui-input-inline">
                        <input autocomplete="off" class="layui-input" id="officialMoney" lay-verify="required"
                               name="officialMoney"
                               placeholder="正式期工资（必填）"
                               type="text">
                    </div>
                </div>
            </div>
        </div>

        <!-- 提交-->
        <div class="layui-form-item" id="sub">
            <div class="layui-input-block" id="flowTwo">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo2">通过</button>
                <input type="button" id="demo3" class="layui-btn" value="不通过"/>
            </div>
        </div>
    </form>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>流程日志</legend>
    </fieldset>
    <ul class="layui-timeline" id="schedule">

    </ul>
</div>
<script>
    let oaEntryEducationTable; // 教育经历
    let oaEntryWorkTable; //工作经历
    let oaEntryTrainTable; //培训经历
    let oaEntryFamilyTable; // 家庭成员
    let oaEmergencyContactTable; // 紧急联络人
    let pkEntryId = getQueryString("pkEntryId");
    let show = getQueryString("show");
    layui.use(['form', 'laydate', 'table'], function () {
        var table = layui.table;
        var form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate;


        //身份证验证
        $("#entryIdentity").on('blur', function () {
            console.info($("#entryIdentity").val());
            if ($("#entryIdentity").val().length !== 18) {
                layer.alert("请输入正确的身份证号", {
                    icon: 2,
                }, function () {
                    layer.msg('请重新输入', {icon: 0});
                    $("#entryIdentity").val("");
                    $("#entryIdentity").focus();
                });

            }
        });

        //出生日期
        laydate.render({
            elem: '#entryBirthday'
        });
        //参加工作时间
        laydate.render({
            elem: '#dimissionTime'
        });
        //入职日期
        laydate.render({
            elem: '#affirmTime'
        });

        //加载民族下拉框
        const nation = getAjaxById(getRootPath() + "OaDataDictionaryAction/findKeyword/NATION");
        $("#entryNation").html('<option value="">请选择民族（必填）</option>');
        $.each(nation, function (index, item) {
            $("#entryNation").append('<option value="' + item.pkDataDictionaryId + '">' + item.dataDictionaryName + '</option>')
        });

        //加载学历下拉框
        const education = getAjaxById(getRootPath() + "OaDataDictionaryAction/findKeyword/EDUCATION");
        $("#entryEducation").html('<option value="">请选择学历（必填）</option>');
        $.each(education, function (index, item) {
            $("#entryEducation").append('<option value="' + item.pkDataDictionaryId + '">' + item.dataDictionaryName + '</option>')
        });

        //加载部门下拉框
        const departmentId = getAjaxById(getRootPath() + "OaDepartmentAction/departmentfindByAll");
        $("#departmentId").html('<option value="">请选择部门（必填）</option>');
        $.each(departmentId.data, function (index, item) {
            $("#departmentId").append('<option value="' + item.pkDepartmentId + '">' + item.departmentName + '</option>')
        });

        form.on('select(departmentId)', function (data) {
            if (data.value) {
                //加载岗位下拉框
                const postId = getAjaxById(getRootPath() + "OaOrganizationAction/organizationFind/" + data.value);
                $("#postId").html('<option value="">请选择岗位（必填）</option>');
                $.each(postId.data, function (index, item) {
                    $("#postId").append('<option value="' + item.pkPostId + '">' + item.postName + '</option>')
                });
            } else {
                $("#postId").html('<option value="">请选择岗位（必填）</option>');
            }
            form.render();
        });

        //加载应聘信息来源下拉框
        const recruitmentInformation = getAjaxById(getRootPath() + "OaDataDictionaryAction/findKeyword/ORIGIN");
        $("#recruitmentInformation").html('<option value="">请选择应聘来源（必填）</option>');
        $.each(recruitmentInformation, function (index, item) {
            $("#recruitmentInformation").append('<option value="' + item.pkDataDictionaryId + '">' + item.dataDictionaryName + '</option>')
        });

        //加载应聘信息来源下拉框
        const healthMaimGrade = getAjaxById(getRootPath() + "OaDataDictionaryAction/findKeyword/MAIM");
        $("#healthMaimGrade").html('<option value="">请选择伤残等级</option>');
        $.each(healthMaimGrade, function (index, item) {
            $("#healthMaimGrade").append('<option value="' + item.pkDataDictionaryId + '">' + item.dataDictionaryName + '</option>')
        });
        //监听指定开关
        form.on('switch(switchTest)', function (data) {
            /*layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });*/
            if (this.checked) {
                $("#isHealthMaimLevel").show();
                $("#isHealthMaims").css("width", "655px");
            } else {
                $("#isHealthMaimLevel").hide();
                $("#isHealthMaims").css("width", "520px");
                $("#healthMaimGrade").val("");
            }
        });

        if (pkEntryId) {
            const res = getAjaxById(getRootPath() + "oaEntryFlowAction/findById/" + pkEntryId);
            if (res) {
                $("#entryArea").val(res.entryArea); // 姓名
                $("#entryBirthday").val(dateFormat("yyyy-MM-dd", new Date(res.entryBirthday))); // 生日
                $("#entryIdentity").val(res.entryIdentity); // 身份证
                $("#entryNation").val(res.entryNation); // 民族
                $("#entryNativeProvince").val(res.entryNativeProvince); // 籍贯
                $("#entryPostcodeResidence").val(res.entryPostcodeResidence); // 通讯邮编
                $("#entryPostcode").val(res.entryPostcode); // 现住邮编
                $("#entryPhone").val(res.entryPhone); // 电话
                $("#entryEducation").val(res.entryEducation); // 最高学历
                $("#entryMajor").val(res.entryMajor); // 专业
                $("#entryForeignLevel").val(res.entryForeignLevel); // 外语及等级
                $("#entryProfessionalQualification").val(res.entryProfessionalQualification); // 职业资格
                $("#entryMajorQualification").val(res.entryMajorQualification); // 专业职称
                $("#entryBankAccount").val(res.entryBankAccount); // 银行账户
                $("#entryBankName").val(res.entryBankName); // 开户行
                $("input[name=entrySex][value='0']").attr("checked", res.entrySex == 0 ? true : false); // 性别 女
                $("input[name=entrySex][value='1']").attr("checked", res.entrySex == 1 ? true : false); // 性别 男
                $("#entryNativeCity").val(res.entryNativeCity); // 户口所在地
                $("input[name=isMarriage][value='0']").attr("checked", res.isMarriage == 0 ? true : false); // 婚姻状况 已婚
                $("input[name=isMarriage][value='1']").attr("checked", res.isMarriage == 1 ? true : false); // 婚姻状况 未婚
                $("input[name=isMarriage][value='2']").attr("checked", res.isMarriage == 2 ? true : false); // 婚姻状况 离异
                $("input[name=isMarriage][value='3']").attr("checked", res.isMarriage == 3 ? true : false); // 婚姻状况 再婚
                $("#entryCurrentResidence").val(res.entryCurrentResidence); // 现住地址
                $("#entryCommunicationResidence").val(res.entryCommunicationResidence); // 通信地址
                $("#healthHeight").val(res.healthHeight); // 身高
                $("#healthWeight").val(res.healthWeight); // 体重
                $("#dimissionTime").val(dateFormat("yyyy-MM-dd", new Date(res.dimissionTime))); // 参加工作时间
                $("#accumulativeDate").val(res.accumulativeDate); // 累计工作时间
                $("#recruitmentInformation").val(res.recruitmentInformation); // 应聘信息来源
                $("#departmentId").val(res.departmentId); // 入职部门
                const postId = getAjaxById(getRootPath() + "OaOrganizationAction/organizationFind/" + res.departmentId);
                $("#postId").html('<option value="">请选择岗位</option>');
                $.each(postId.data, function (index, item) {
                    $("#postId").append('<option value="' + item.pkPostId + '">' + item.postName + '</option>')
                });
                $("#postId").val(res.postId); // 入职岗位
                $("#affirmTime").val(dateFormat("yyyy-MM-dd", new Date(res.affirmTime))); // 入职时间
                $("input[name=isHealthEyesight][value='0']").attr("checked", res.isHealthEyesight == 0 ? true : false); // 视力 辅助
                $("input[name=isHealthEyesight][value='1']").attr("checked", res.isHealthEyesight == 1 ? true : false); // 视力 良好
                $("input[name=isHealthEar][value='0']").attr("checked", res.isHealthEar == 0 ? true : false); // 听力 辅助
                $("input[name=isHealthEar][value='1']").attr("checked", res.isHealthEar == 1 ? true : false); // 听力 良好
                $("#employCondition").val(res.employCondition); // 录用条件
                $("#isHealthInjury").attr("checked", res.isHealthInjury == 0 ? true : false); // 工伤
                $("#isHealthHeavyManual").attr("checked", res.isHealthHeavyManual == 0 ? true : false); // 高危工作
                $("#isHealthContagion").attr("checked", res.isHealthContagion == 0 ? true : false); // 传染疾病
                $("#isAnnualVacation").attr("checked", res.isAnnualVacation == 0 ? true : false); // 是否休完年假
                $("#isPenal").attr("checked", res.isPenal == 0 ? true : false); // 刑事记录
                $("#formeWork").attr("checked", res.formeWork == 0 ? true : false); // 本公司工作过
                $("#isHealthMaim").attr("checked", res.isHealthMaim == 0 ? true : false); // 伤残
                if (res.isHealthMaim == 0) {
                    $("#isHealthMaimLevel").show();
                    $("#isHealthMaims").css("width", "655px");
                }
                $("#healthMaimGrade").val(res.healthMaimGrade); // 伤残等级
                $("#healthTreat").val(res.healthTreat); // 医学治疗

                if (show) {
                    $("#sub").remove();
                    if (!isButton("ENTRY_CHECK")) {
                        $("#entryCheck").remove();
                    } else {
                        $("#trialDate").val(res.trialDate); // 使用期限
                        $("#trialDate").attr("disabled", "");
                        $("#trialMoney").val(res.trialMoney); // 试用期工资
                        $("#trialMoney").attr("disabled", "");
                        $("#officialMoney").val(res.officialMoney); // 转正期工资
                        $("#officialMoney").attr("disabled", "");
                    }
                }


                form.render();
            }
            $("#flows").hide();
            $("#entryArea").attr("disabled", ""); // 姓名
            $("#entryBirthday").attr("disabled", ""); // 生日
            $("#entryIdentity").attr("disabled", ""); // 身份证
            $("#entryNation").attr("disabled", ""); // 民族
            $("#entryNativeProvince").attr("disabled", ""); // 籍贯
            $("#entryPostcodeResidence").attr("disabled", ""); // 通讯邮编
            $("#entryPostcode").attr("disabled", ""); // 现住邮编
            $("#entryPhone").attr("disabled", ""); // 电话
            $("#entryEducation").attr("disabled", ""); // 最高学历
            $("#entryMajor").attr("disabled", ""); // 专业
            $("#entryForeignLevel").attr("disabled", ""); // 外语及等级
            $("#entryProfessionalQualification").attr("disabled", ""); // 职业资格
            $("#entryMajorQualification").attr("disabled", ""); // 专业职称
            $("#entryBankAccount").attr("disabled", ""); // 银行账户
            $("#entryBankName").attr("disabled", ""); // 开户行
            $("#entrySexMan").attr("disabled", ""); // 性别男
            $("#entrySexGirl").attr("disabled", ""); // 性别女
            $("#entryNativeCity").attr("disabled", ""); // 户口所在地
            $("#isMarriage0").attr("disabled", ""); // 婚姻状况 已婚
            $("#isMarriage1").attr("disabled", ""); // 婚姻状况 未婚
            $("#isMarriage2").attr("disabled", ""); // 婚姻状况 离异
            $("#isMarriage3").attr("disabled", ""); // 婚姻状况 再婚
            $("#entryCurrentResidence").attr("disabled", ""); // 现住地址
            $("#entryCommunicationResidence").attr("disabled", ""); // 通信地址
            $("#healthHeight").attr("disabled", ""); // 身高
            $("#healthWeight").attr("disabled", ""); // 体重
            $("#dimissionTime").attr("disabled", ""); // 参加工作时间
            $("#accumulativeDate").attr("disabled", ""); // 累计工作时间
            $("#recruitmentInformation").attr("disabled", ""); // 应聘信息来源
            $("#departmentId").attr("disabled", ""); // 入职部门
            $("#postId").attr("disabled", ""); // 入职岗位
            $("#affirmTime").attr("disabled", ""); // 入职时间
            $("#isHealthEyesight0").attr("disabled", ""); // 视力 辅助
            $("#isHealthEyesight1").attr("disabled", ""); // 视力 良好
            $("#isHealthEar0").attr("disabled", ""); // 听力 辅助
            $("#isHealthEar1").attr("disabled", ""); // 听力 良好
            $("#employCondition").attr("disabled", ""); // 录用条件
            $("#isHealthInjury").attr("disabled", ""); // 工伤
            $("#isHealthHeavyManual").attr("disabled", ""); // 高危工作
            $("#isHealthContagion").attr("disabled", ""); // 传染疾病
            $("#isAnnualVacation").attr("disabled", ""); // 是否休完年假
            $("#isPenal").attr("disabled", ""); // 刑事记录
            $("#formeWork").attr("disabled", ""); // 本公司工作过
            $("#isHealthMaim").attr("disabled", ""); // 伤残
            $("#healthMaimGrade").attr("disabled", ""); // 伤残等级
            $("#healthTreat").attr("disabled", ""); // 医学治疗
            $("#pkEntryId").val(pkEntryId);
            form.render();
        }


        oaEntryEducationTable = table.render({
            elem: '#oaEntryEducation'
            , url: getRootPath() + 'oaEntryEducation/selectAll?entryId=' + $("#pkEntryId").val()
            , headers: {token: token}
            , title: '教育经历'
            , parseData: function (res) {
                if (res.code === 500) {
                    return false
                }
                return {
                    "code": res.data.code,
                    "msg": res.data.msg,
                    "count": res.data.count,
                    "data": res.data.data
                };
            }
            , cols: [[
                {type: 'numbers', title: '序列', fixed: 'left', width: 120}
                , {
                    field: 'startTime', title: '开始时间', templet: function (row) {
                        if (row.startTime) {
                            return dateFormat("yyyy-MM-dd", new Date(row.startTime));
                        } else {
                            return "";
                        }
                    }, width: 120
                }
                , {
                    field: 'endTime', title: '结束时间', templet: function (row) {
                        if (row.endTime) {
                            return dateFormat("yyyy-MM-dd", new Date(row.endTime));
                        } else {
                            return "";
                        }
                    }, width: 120
                }
                , {field: 'educationSchool', title: '院校名称', width: 120}
                , {field: 'educationDegree', title: '学历', width: 120}
                , {field: 'educationMajor', title: '专业', width: 120}
                , {field: 'educationSeries', title: '证书', width: 120}
            ]]
        });


        oaEntryWorkTable = table.render({
            elem: '#oaEntryWork'
            , url: getRootPath() + 'oaEntryWork/selectAll?entryId=' + $("#pkEntryId").val()
            , headers: {token: token}
            , title: '工作经历'
            , parseData: function (res) {
                if (res.code === 500) {
                    return false
                }
                return {
                    "code": res.data.code,
                    "msg": res.data.msg,
                    "count": res.data.count,
                    "data": res.data.data
                };
            }
            , cols: [[
                {type: 'numbers', title: '序列', fixed: 'left'}
                , {
                    field: 'startTime', title: '开始时间', templet: function (row) {
                        if (row.startTime) {
                            return dateFormat("yyyy-MM-dd", new Date(row.startTime));
                        } else {
                            return "";
                        }
                    }
                }
                , {
                    field: 'endTime', title: '结束时间', templet: function (row) {
                        if (row.endTime) {
                            return dateFormat("yyyy-MM-dd", new Date(row.endTime));
                        } else {
                            return "";
                        }
                    }
                }
                , {field: 'workUnit', title: '工作单位'}
                , {field: 'workPost', title: '职位'}
                , {field: 'voucher', title: '证明人姓名'}
                , {field: 'phone', title: '证明人电话'}
                , {field: 'reasonsForLeaving', title: '离职原因'}
            ]]
        });
        oaEntryTrainTable = table.render({
            elem: '#oaEntryTrain'
            , url: getRootPath() + 'oaEntryTrain/selectAll?entryId=' + $("#pkEntryId").val()
            , headers: {token: token}
            , title: '培训经历'
            , parseData: function (res) {
                if (res.code === 500) {
                    return false
                }
                return {
                    "code": res.data.code,
                    "msg": res.data.msg,
                    "count": res.data.count,
                    "data": res.data.data
                };
            }
            , cols: [[
                {type: 'numbers', title: '序列', fixed: 'left'}
                , {
                    field: 'startTime', title: '开始时间', templet: function (row) {
                        if (row.startTime) {
                            return dateFormat("yyyy-MM-dd", new Date(row.startTime));
                        } else {
                            return "";
                        }
                    }
                }
                , {
                    field: 'endTime', title: '结束时间', templet: function (row) {
                        if (row.endTime) {
                            return dateFormat("yyyy-MM-dd", new Date(row.endTime));
                        } else {
                            return "";
                        }
                    }
                }
                , {field: 'trainContent', title: '培训内容'}
                , {field: 'trainInstitutional', title: '培训组织机构'}
                , {field: 'trainResult', title: '培训结果'}
            ]]
        });
        oaEntryFamilyTable = table.render({
            elem: '#oaEntryFamily'
            , url: getRootPath() + 'oaEntryFamily/selectAll?entryId=' + $("#pkEntryId").val()
            , headers: {token: token}
            , title: '家庭成员'
            , parseData: function (res) {
                if (res.code === 500) {
                    return false
                }
                return {
                    "code": res.data.code,
                    "msg": res.data.msg,
                    "count": res.data.count,
                    "data": res.data.data
                };
            }
            , cols: [[
                {type: 'numbers', title: '序列', fixed: 'left'}
                , {field: 'familyName', title: '姓名'}
                , {field: 'relation', title: '关系'}
                , {field: 'familyEmployer', title: '工作单位'}
                , {field: 'post', title: '所在岗位及职务'}
            ]]
        });
        oaEmergencyContactTable = table.render({
            elem: '#oaEmergencyContact'
            , url: getRootPath() + 'oaEmergencyContact/selectAll?entryId=' + $("#pkEntryId").val()
            , headers: {token: token}
            , title: '紧急联络人'
            , parseData: function (res) {
                if (res.code === 500) {
                    return false
                }
                return {
                    "code": res.data.code,
                    "msg": res.data.msg,
                    "count": res.data.count,
                    "data": res.data.data
                };
            }
            , cols: [[
                {type: 'numbers', title: '序列', fixed: 'left'}
                , {field: 'emergencyContactName', title: '姓名'}
                , {field: 'relation', title: '关系'}
                , {field: 'emergencyContactAddress', title: '联系地址'}
                , {field: 'emergencyContactPostcode', title: '联系邮编'}
                , {field: 'emergencyContactPhone', title: '电话'}
            ]]
        });
        //监听审核提交通过
        form.on('submit(demo2)', function (data) {
            $.ajaxSettings.async = false;
            let is = 0;
            //prompt层
            layer.prompt({
                formType: 2,
                value: ' ',
                title: '请输入原因',
                area: ['300px', '100px']
            }, function (text, index) {
                layer.close(index);
                /*layer.msg('您最后写下了：'+text);*/
                let datas = {
                    formReason: text,
                    trialDate: $("#trialDate").val(),
                    officialMoney: $("#officialMoney").val(),
                    trialMoney: $("#trialMoney").val(),
                    pkEntryId: $("#pkEntryId").val()
                };

                const res = postAjax(getRootPath() + "oaEntryFlowAction/auditPass", datas);
                if (res.code === 1) {
                    layer.msg('提交成功3秒后关闭当前窗口', {icon: 1});
                    setTimeout(function () {
                        formClose();
                    },3000);
                    setTimeout(function () {
                        parent.layui.table.reload('test');//刷新父页面
                        //window.parent.location.reload();//刷新父页面
                        const index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index);
                    },3001);
                } else if (res.code === 500) {
                    error('500');
                } else {
                    layer.msg("提交失败");
                }
            });
            return false;
        });

        //监听审核提交不通过
        $('#demo3').on('click', function () {
            //prompt层
            layer.prompt({
                formType: 2,
                value: '',
                title: '请输入原因',
                area: ['300px', '100px']
            }, function (text, index) {
                layer.close(index);
                let datas = {
                    formReason: text,
                    pkEntryId: $("#pkEntryId").val()
                };
                /*layer.msg('您最后写下了：'+text);*/
                const res = postAjax(getRootPath() + "oaEntryFlowAction/auditNoPass", datas);
                if (res.code === 1) {
                    layer.msg('提交成功3秒后关闭当前窗口', {icon: 1});
                    setTimeout(function () {
                        formClose();
                    },3000);
                    setTimeout(function () {
                        parent.layui.table.reload('test');//刷新父页面
                        //window.parent.location.reload();//刷新父页面
                        const index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index);
                    },3001);
                } else if (res.code === 500) {
                    error('500');
                } else {
                    layer.msg("新增失败");
                }
            });

            return false;
        });


        if (isButton("ENTRY_CHECK") && $("#isRevision").val() == "L") {
            $("#entryCheck").show();
            $("#trialDate").attr("lay-verify", "required");
            $("#trialMoney").attr("lay-verify", "required");
            $("#officialMoney").attr("lay-verify", "required");
        }
        const res = getAjaxById(getRootPath() + "OaFlowAction/selectFlowSchedule/" + $("#pkEntryId").val());
        $("#schedule").html("");
        $.each(res, function (index, item) {
            if (item.createdBy) {
                $("#schedule").append('<li class="layui-timeline-item">\n' +
                    '        <i class="layui-icon layui-timeline-axis"></i>\n' +
                    '        <div class="layui-timeline-content layui-text">\n' +
                    '            <h3 class="layui-timeline-title">' + dateFormat('yyyy-MM-dd hh:mm:ss', new Date(item.createdTime)) + '&nbsp;&nbsp;&nbsp;' + item.flowName + '</h3>\n' +
                    '            <p>' + item.formReason + '</p>\n' +
                    '            <p>操作人：' + item.createdBy + '</p>\n' +
                    '        </div>\n' +
                    '    </li>')

            } else {
                $("#schedule").append('<li class="layui-timeline-item">\n' +
                    '        <i class="layui-icon layui-timeline-axis"></i>\n' +
                    '        <div class="layui-timeline-content layui-text">\n' +
                    '            <h3 class="layui-timeline-title">' + dateFormat('yyyy-MM-dd hh:mm:ss', new Date(item.createdTime)) + '&nbsp;&nbsp;&nbsp;' + item.flowName + '</h3>\n' +
                    '            <p>' + item.formReason + '</p>\n' +
                    '        </div>\n' +
                    '    </li>')
            }
        });

        $("#bodys").show();

        form.render();
    });
</script>
</body>
</html>